<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<!--
 属性的私有化
  #
-->
<script>

    class Phone {
        #brand
        #price
        constructor(brand, price) {
            this.#price = price
            this.#brand = brand
        }

        getBrand(){
            return this.#brand
        }

        setBrand(brand){
           this.#brand = brand
        }

        getPrice(){
            return this.#price
        }

        setPrice(price){
            this.#price = price
        }
    }

    let  mi = new Phone('mi',2000)
    console.log(mi)
    console.log(mi.getPrice())
    console.log(mi.getBrand())

    console.log('---------------------------')
    mi.setBrand('redMi')
    mi.setPrice(1500)

    console.log(mi.getPrice())
    console.log(mi.getBrand())

</script>


</body>
</html>